using System;
using System.Collections.Generic;
using System.Text;

namespace IGlobalist.Cms.Model
{
    public class CmsObjectFactory : ICmsObjectFactory
    {
        private static ICmsObjectFactory _Instance;
        private CmsObjectFactory(){
        }
        public static ICmsObjectFactory GetInstance()
        {
            if (_Instance == null)
                _Instance = new CmsObjectFactory();
            return _Instance;
        }

        #region ICmsObjectFactory Members

        public ICmsObject GetNewCmsObject(CmsObjectType type)
        {
            switch (type)
            {
                case CmsObjectType.Page:
                    return new Page();                    
                case CmsObjectType.ContentCategory:
                    return new Category();
                case CmsObjectType.Content:
                    return new Content();
                case CmsObjectType.ContentNote:
                    return new ContentNote();
                case CmsObjectType.Role:
                    return new Role();
                case CmsObjectType.User:
                    return new User();
                case CmsObjectType.Template:
                    return new Template();
                case CmsObjectType.ResourceFile:
                    return new ResourceFile();
                case CmsObjectType.ResourceFolder:
                    return new ResourceFolder();
            }
            return null;
        }

        #endregion
    }
}
